<%@ page language="java" contentType="text/html; charset=utf-8"  
import="com.brother.model.*,java.util.*" pageEncoding="utf-8"%>
<jsp:useBean id="service" class="com.brother.service.UserService"></jsp:useBean>
<jsp:useBean id="customer" class="com.brother.model.Customer"></jsp:useBean>
<%
com.brother.model.Customer loginUser = (com.brother.model.Customer)session.getAttribute(com.brother.Constants.LOGIN_SESSTION_NAME);
if(loginUser ==null){
	return;
}
String query = request.getParameter("query");



List<Customer> users = new ArrayList();
if(query == null || query.isEmpty() || loginUser.getName().startsWith(query))
users.add(loginUser);

users.addAll(service.getChildUsers(loginUser.getUserid(), query));



out.print("[");
for(int i =0; i < users.size(); i++){
	out.println("["); 
	out.print("'"+users.get(i).getUserid() +"',");
	out.print("'"+users.get(i).getName().trim().replaceAll("\'","") +"'");
	out.print("]");
	if(i < users.size() - 1){
		out.print(",");
	}
}
out.print("]");



%><%
com.brother.database.DataBase.closeThreadConnection();
%>